<?php


abstract class BaseProduct extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $user_id;


	
	protected $status_id;


	
	protected $priority;


	
	protected $tags;


	
	protected $category_id;


	
	protected $code;


	
	protected $price;


	
	protected $price_promo;


	
	protected $price_special;


	
	protected $currency_code;


	
	protected $quantity;


	
	protected $updated_at;


	
	protected $created_at;


	
	protected $promo_start;


	
	protected $promo_end;


	
	protected $id;

	
	protected $collProductI18ns;

	
	protected $lastProductI18nCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

  
  protected $culture;

	
	public function getUserId()
	{

		return $this->user_id;
	}

	
	public function getStatusId()
	{

		return $this->status_id;
	}

	
	public function getPriority()
	{

		return $this->priority;
	}

	
	public function getTags()
	{

		return $this->tags;
	}

	
	public function getCategoryId()
	{

		return $this->category_id;
	}

	
	public function getCode()
	{

		return $this->code;
	}

	
	public function getPrice()
	{

		return $this->price;
	}

	
	public function getPricePromo()
	{

		return $this->price_promo;
	}

	
	public function getPriceSpecial()
	{

		return $this->price_special;
	}

	
	public function getCurrencyCode()
	{

		return $this->currency_code;
	}

	
	public function getQuantity()
	{

		return $this->quantity;
	}

	
	public function getUpdatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->updated_at === null || $this->updated_at === '') {
			return null;
		} elseif (!is_int($this->updated_at)) {
						$ts = strtotime($this->updated_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
			}
		} else {
			$ts = $this->updated_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getCreatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->created_at === null || $this->created_at === '') {
			return null;
		} elseif (!is_int($this->created_at)) {
						$ts = strtotime($this->created_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
			}
		} else {
			$ts = $this->created_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getPromoStart($format = 'Y-m-d H:i:s')
	{

		if ($this->promo_start === null || $this->promo_start === '') {
			return null;
		} elseif (!is_int($this->promo_start)) {
						$ts = strtotime($this->promo_start);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [promo_start] as date/time value: " . var_export($this->promo_start, true));
			}
		} else {
			$ts = $this->promo_start;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getPromoEnd($format = 'Y-m-d H:i:s')
	{

		if ($this->promo_end === null || $this->promo_end === '') {
			return null;
		} elseif (!is_int($this->promo_end)) {
						$ts = strtotime($this->promo_end);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [promo_end] as date/time value: " . var_export($this->promo_end, true));
			}
		} else {
			$ts = $this->promo_end;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getId()
	{

		return $this->id;
	}

	
	public function setUserId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->user_id !== $v) {
			$this->user_id = $v;
			$this->modifiedColumns[] = ProductPeer::USER_ID;
		}

	} 
	
	public function setStatusId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->status_id !== $v) {
			$this->status_id = $v;
			$this->modifiedColumns[] = ProductPeer::STATUS_ID;
		}

	} 
	
	public function setPriority($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->priority !== $v) {
			$this->priority = $v;
			$this->modifiedColumns[] = ProductPeer::PRIORITY;
		}

	} 
	
	public function setTags($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->tags !== $v) {
			$this->tags = $v;
			$this->modifiedColumns[] = ProductPeer::TAGS;
		}

	} 
	
	public function setCategoryId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->category_id !== $v) {
			$this->category_id = $v;
			$this->modifiedColumns[] = ProductPeer::CATEGORY_ID;
		}

	} 
	
	public function setCode($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->code !== $v) {
			$this->code = $v;
			$this->modifiedColumns[] = ProductPeer::CODE;
		}

	} 
	
	public function setPrice($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->price !== $v) {
			$this->price = $v;
			$this->modifiedColumns[] = ProductPeer::PRICE;
		}

	} 
	
	public function setPricePromo($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->price_promo !== $v) {
			$this->price_promo = $v;
			$this->modifiedColumns[] = ProductPeer::PRICE_PROMO;
		}

	} 
	
	public function setPriceSpecial($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->price_special !== $v) {
			$this->price_special = $v;
			$this->modifiedColumns[] = ProductPeer::PRICE_SPECIAL;
		}

	} 
	
	public function setCurrencyCode($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->currency_code !== $v) {
			$this->currency_code = $v;
			$this->modifiedColumns[] = ProductPeer::CURRENCY_CODE;
		}

	} 
	
	public function setQuantity($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->quantity !== $v) {
			$this->quantity = $v;
			$this->modifiedColumns[] = ProductPeer::QUANTITY;
		}

	} 
	
	public function setUpdatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->updated_at !== $ts) {
			$this->updated_at = $ts;
			$this->modifiedColumns[] = ProductPeer::UPDATED_AT;
		}

	} 
	
	public function setCreatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_at !== $ts) {
			$this->created_at = $ts;
			$this->modifiedColumns[] = ProductPeer::CREATED_AT;
		}

	} 
	
	public function setPromoStart($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [promo_start] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->promo_start !== $ts) {
			$this->promo_start = $ts;
			$this->modifiedColumns[] = ProductPeer::PROMO_START;
		}

	} 
	
	public function setPromoEnd($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [promo_end] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->promo_end !== $ts) {
			$this->promo_end = $ts;
			$this->modifiedColumns[] = ProductPeer::PROMO_END;
		}

	} 
	
	public function setId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = ProductPeer::ID;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->user_id = $rs->getInt($startcol + 0);

			$this->status_id = $rs->getInt($startcol + 1);

			$this->priority = $rs->getInt($startcol + 2);

			$this->tags = $rs->getString($startcol + 3);

			$this->category_id = $rs->getInt($startcol + 4);

			$this->code = $rs->getString($startcol + 5);

			$this->price = $rs->getInt($startcol + 6);

			$this->price_promo = $rs->getInt($startcol + 7);

			$this->price_special = $rs->getInt($startcol + 8);

			$this->currency_code = $rs->getString($startcol + 9);

			$this->quantity = $rs->getInt($startcol + 10);

			$this->updated_at = $rs->getTimestamp($startcol + 11, null);

			$this->created_at = $rs->getTimestamp($startcol + 12, null);

			$this->promo_start = $rs->getTimestamp($startcol + 13, null);

			$this->promo_end = $rs->getTimestamp($startcol + 14, null);

			$this->id = $rs->getInt($startcol + 15);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 16; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Product object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ProductPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			ProductPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
    if ($this->isModified() && !$this->isColumnModified(ProductPeer::UPDATED_AT))
    {
      $this->setUpdatedAt(time());
    }

    if ($this->isNew() && !$this->isColumnModified(ProductPeer::CREATED_AT))
    {
      $this->setCreatedAt(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ProductPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = ProductPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += ProductPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collProductI18ns !== null) {
				foreach($this->collProductI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = ProductPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collProductI18ns !== null) {
					foreach($this->collProductI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getUserId();
				break;
			case 1:
				return $this->getStatusId();
				break;
			case 2:
				return $this->getPriority();
				break;
			case 3:
				return $this->getTags();
				break;
			case 4:
				return $this->getCategoryId();
				break;
			case 5:
				return $this->getCode();
				break;
			case 6:
				return $this->getPrice();
				break;
			case 7:
				return $this->getPricePromo();
				break;
			case 8:
				return $this->getPriceSpecial();
				break;
			case 9:
				return $this->getCurrencyCode();
				break;
			case 10:
				return $this->getQuantity();
				break;
			case 11:
				return $this->getUpdatedAt();
				break;
			case 12:
				return $this->getCreatedAt();
				break;
			case 13:
				return $this->getPromoStart();
				break;
			case 14:
				return $this->getPromoEnd();
				break;
			case 15:
				return $this->getId();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ProductPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getUserId(),
			$keys[1] => $this->getStatusId(),
			$keys[2] => $this->getPriority(),
			$keys[3] => $this->getTags(),
			$keys[4] => $this->getCategoryId(),
			$keys[5] => $this->getCode(),
			$keys[6] => $this->getPrice(),
			$keys[7] => $this->getPricePromo(),
			$keys[8] => $this->getPriceSpecial(),
			$keys[9] => $this->getCurrencyCode(),
			$keys[10] => $this->getQuantity(),
			$keys[11] => $this->getUpdatedAt(),
			$keys[12] => $this->getCreatedAt(),
			$keys[13] => $this->getPromoStart(),
			$keys[14] => $this->getPromoEnd(),
			$keys[15] => $this->getId(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ProductPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setUserId($value);
				break;
			case 1:
				$this->setStatusId($value);
				break;
			case 2:
				$this->setPriority($value);
				break;
			case 3:
				$this->setTags($value);
				break;
			case 4:
				$this->setCategoryId($value);
				break;
			case 5:
				$this->setCode($value);
				break;
			case 6:
				$this->setPrice($value);
				break;
			case 7:
				$this->setPricePromo($value);
				break;
			case 8:
				$this->setPriceSpecial($value);
				break;
			case 9:
				$this->setCurrencyCode($value);
				break;
			case 10:
				$this->setQuantity($value);
				break;
			case 11:
				$this->setUpdatedAt($value);
				break;
			case 12:
				$this->setCreatedAt($value);
				break;
			case 13:
				$this->setPromoStart($value);
				break;
			case 14:
				$this->setPromoEnd($value);
				break;
			case 15:
				$this->setId($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ProductPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setUserId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setStatusId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setPriority($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setTags($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setCategoryId($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setCode($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setPrice($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setPricePromo($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setPriceSpecial($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setCurrencyCode($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setQuantity($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setUpdatedAt($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setPromoStart($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setPromoEnd($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setId($arr[$keys[15]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(ProductPeer::DATABASE_NAME);

		if ($this->isColumnModified(ProductPeer::USER_ID)) $criteria->add(ProductPeer::USER_ID, $this->user_id);
		if ($this->isColumnModified(ProductPeer::STATUS_ID)) $criteria->add(ProductPeer::STATUS_ID, $this->status_id);
		if ($this->isColumnModified(ProductPeer::PRIORITY)) $criteria->add(ProductPeer::PRIORITY, $this->priority);
		if ($this->isColumnModified(ProductPeer::TAGS)) $criteria->add(ProductPeer::TAGS, $this->tags);
		if ($this->isColumnModified(ProductPeer::CATEGORY_ID)) $criteria->add(ProductPeer::CATEGORY_ID, $this->category_id);
		if ($this->isColumnModified(ProductPeer::CODE)) $criteria->add(ProductPeer::CODE, $this->code);
		if ($this->isColumnModified(ProductPeer::PRICE)) $criteria->add(ProductPeer::PRICE, $this->price);
		if ($this->isColumnModified(ProductPeer::PRICE_PROMO)) $criteria->add(ProductPeer::PRICE_PROMO, $this->price_promo);
		if ($this->isColumnModified(ProductPeer::PRICE_SPECIAL)) $criteria->add(ProductPeer::PRICE_SPECIAL, $this->price_special);
		if ($this->isColumnModified(ProductPeer::CURRENCY_CODE)) $criteria->add(ProductPeer::CURRENCY_CODE, $this->currency_code);
		if ($this->isColumnModified(ProductPeer::QUANTITY)) $criteria->add(ProductPeer::QUANTITY, $this->quantity);
		if ($this->isColumnModified(ProductPeer::UPDATED_AT)) $criteria->add(ProductPeer::UPDATED_AT, $this->updated_at);
		if ($this->isColumnModified(ProductPeer::CREATED_AT)) $criteria->add(ProductPeer::CREATED_AT, $this->created_at);
		if ($this->isColumnModified(ProductPeer::PROMO_START)) $criteria->add(ProductPeer::PROMO_START, $this->promo_start);
		if ($this->isColumnModified(ProductPeer::PROMO_END)) $criteria->add(ProductPeer::PROMO_END, $this->promo_end);
		if ($this->isColumnModified(ProductPeer::ID)) $criteria->add(ProductPeer::ID, $this->id);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(ProductPeer::DATABASE_NAME);

		$criteria->add(ProductPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setUserId($this->user_id);

		$copyObj->setStatusId($this->status_id);

		$copyObj->setPriority($this->priority);

		$copyObj->setTags($this->tags);

		$copyObj->setCategoryId($this->category_id);

		$copyObj->setCode($this->code);

		$copyObj->setPrice($this->price);

		$copyObj->setPricePromo($this->price_promo);

		$copyObj->setPriceSpecial($this->price_special);

		$copyObj->setCurrencyCode($this->currency_code);

		$copyObj->setQuantity($this->quantity);

		$copyObj->setUpdatedAt($this->updated_at);

		$copyObj->setCreatedAt($this->created_at);

		$copyObj->setPromoStart($this->promo_start);

		$copyObj->setPromoEnd($this->promo_end);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getProductI18ns() as $relObj) {
				$copyObj->addProductI18n($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new ProductPeer();
		}
		return self::$peer;
	}

	
	public function initProductI18ns()
	{
		if ($this->collProductI18ns === null) {
			$this->collProductI18ns = array();
		}
	}

	
	public function getProductI18ns($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseProductI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collProductI18ns === null) {
			if ($this->isNew()) {
			   $this->collProductI18ns = array();
			} else {

				$criteria->add(ProductI18nPeer::ID, $this->getId());

				ProductI18nPeer::addSelectColumns($criteria);
				$this->collProductI18ns = ProductI18nPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ProductI18nPeer::ID, $this->getId());

				ProductI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastProductI18nCriteria) || !$this->lastProductI18nCriteria->equals($criteria)) {
					$this->collProductI18ns = ProductI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastProductI18nCriteria = $criteria;
		return $this->collProductI18ns;
	}

	
	public function countProductI18ns($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseProductI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ProductI18nPeer::ID, $this->getId());

		return ProductI18nPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addProductI18n(ProductI18n $l)
	{
		$this->collProductI18ns[] = $l;
		$l->setProduct($this);
	}

  public function getCulture()
  {
    return $this->culture;
  }

  public function setCulture($culture)
  {
    $this->culture = $culture;
  }

  public function getName()
  {
    $obj = $this->getCurrentProductI18n();

    return ($obj ? $obj->getName() : null);
  }

  public function setName($value)
  {
    $this->getCurrentProductI18n()->setName($value);
  }

  public function getText()
  {
    $obj = $this->getCurrentProductI18n();

    return ($obj ? $obj->getText() : null);
  }

  public function setText($value)
  {
    $this->getCurrentProductI18n()->setText($value);
  }

  public function getSummary()
  {
    $obj = $this->getCurrentProductI18n();

    return ($obj ? $obj->getSummary() : null);
  }

  public function setSummary($value)
  {
    $this->getCurrentProductI18n()->setSummary($value);
  }

  public function getTextPromo()
  {
    $obj = $this->getCurrentProductI18n();

    return ($obj ? $obj->getTextPromo() : null);
  }

  public function setTextPromo($value)
  {
    $this->getCurrentProductI18n()->setTextPromo($value);
  }

  protected $current_i18n = array();

  public function getCurrentProductI18n()
  {
    if (!isset($this->current_i18n[$this->culture]))
    {
      $obj = ProductI18nPeer::retrieveByPK($this->getId(), $this->culture);
      if ($obj)
      {
        $this->setProductI18nForCulture($obj, $this->culture);
      }
      else
      {
        $this->setProductI18nForCulture(new ProductI18n(), $this->culture);
        $this->current_i18n[$this->culture]->setCulture($this->culture);
      }
    }

    return $this->current_i18n[$this->culture];
  }

  public function setProductI18nForCulture($object, $culture)
  {
    $this->current_i18n[$culture] = $object;
    $this->addProductI18n($object);
  }

} 